package com.msmall.community.money.model;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.msmall.base.model.BaseObject;
import com.msmall.community.user.model.UserInfo;

@Entity
@Table(name="base_user_money_transaction")
public class MoneyTransaction extends BaseObject{
	
	private static final long serialVersionUID = -7793472526094005674L;

	@Id
	@Column(name="transaction_id",insertable=false,updatable=false)
	@GeneratedValue(strategy=GenerationType.AUTO)
	private Long transactionId;
	
	@Column(name="types")
	private Integer types; //交易类型 0未知，1购买等级 2购买形象
	
	@Column(name="amount")
	private Double amount; //交易数量 正表示加； 负表示减
	
	@Column(name="content")
	private String content; //系统对交易的描述
	
	@Column(name="comment")
	private String comment; //用户备注
	
	@Column(name="trans_time")
	@Temporal(TemporalType.TIMESTAMP)
	private Date transTime; //交易时间
	
	@Column(name="enabled")
	private Short enabled; // ConstantDB.AVALIABLE

	@ManyToOne(cascade = {CascadeType.PERSIST,CascadeType.MERGE},fetch=FetchType.LAZY)
	@JoinColumn(name="user_id")
	private UserInfo user;

	public Long getTransactionId() {
		return transactionId;
	}

	public void setTransactionId(Long transactionId) {
		this.transactionId = transactionId;
	}

	public Integer getTypes() {
		return types;
	}

	public void setTypes(Integer types) {
		this.types = types;
	}

	public Double getAmount() {
		return amount;
	}

	public void setAmount(Double amount) {
		this.amount = amount;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getComment() {
		return comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}

	public Date getTransTime() {
		return transTime;
	}

	public void setTransTime(Date transTime) {
		this.transTime = transTime;
	}

	public Short getEnabled() {
		return enabled;
	}

	public void setEnabled(Short enabled) {
		this.enabled = enabled;
	}

	public UserInfo getUser() {
		return user;
	}

	public void setUser(UserInfo user) {
		this.user = user;
	}

	public boolean equals(Object o) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public int hashCode() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return null;
	}
}
